<template>
    <div class="right">
      <el-row>
          <el-col :span="24">
              <el-breadcrumb separator="/">
                  <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                  <el-breadcrumb-item><a href="#">权限管理</a></el-breadcrumb-item>
                  <el-breadcrumb-item>权限列表</el-breadcrumb-item>
              </el-breadcrumb>
          </el-col>
      </el-row>
       <el-table
         v-loading="loading"
         :data="rightlist"
         style="width:100%">
          <el-table-column
              type="index"
              width="50">
          </el-table-column>
          <el-table-column
              prop="authName"
              label="权限名称"
              width="180">
          </el-table-column>
          <el-table-column
              prop="path"
              label="路径"
              width="180">
          </el-table-column>
          <el-table-column label="层级">
              <template slot-scope="scope">
                 <span>{{scope.row.level | filtem()}}</span>
              </template>
        </el-table-column>
      </el-table>
    </div>
</template>
<script>
import {getright} from "@/api/index"
export default {
    data(){
       return{
            loading:true,
            rightlist:[],
       }
    },
    created(){
        this.initright()
    },
    filters:{
      filtem(leavl){
          if(leavl === '0'){
              return '1级'
          }else if(leavl === '1'){
              return '2级'
          }else{
              return "3级"
          }
      }
    },
    methods:{
        initright(){
           this.loading = true;
           getright({type:'list'}).then(res=>{
               if(res.meta.status == 200){
                   this.rightlist = res.data
               }
           })
            this.loading = false;
        }
    }

}
</script>
<style lang="sass" scped>

</style>


